import { getAction, deleteAction, postAction ,putAction} from '@/api/manage'

const template = '/jic-backend-wechat/wechat-client/template'//https://jic.jnby.com/jic/jic-backend-wechat

//订阅消息
const messageList = params => getAction(template + '/config/list', params) // 订阅消息列表
const templateList = params => getAction(template + '/link/list', params) // 订阅消息模板列表
const downLoadLog = params => getAction(template + '/message/log/export/' + params.id) // 下载订阅消息日志
const templateDelete = params => deleteAction(template + '/link', params) //删除模板
const messageDelete = params => deleteAction(template + '/config', params) //删除消息
const sendMessage = params => postAction(template + '/notify/push/' + params.id) //发送消息
const templateDetail = params => getAction(template + '/link/' + params.id) // 订阅消息模板详情
const messageDetail = params => getAction(template + '/config/' + params.id) // 订阅消息详情
const createTemplate = params => postAction(template + '/link/addOrUpdate', params) // 新增、编辑订阅消息模板
const createMessage = params => postAction(template + '/config/addOrUpdate', params) // 新增、编辑订阅消息
// const exportXsl = 'https://jic.jnby.com/jic/jic-backend-wechat/wechat-client/template/message/log/export/'//导出exsl
const exportXsl = 'https://bzhz.jnbygroup.com/api/gateway/jic-backend-wechat/wechat-client/template/message/log/export/'


//运维管理
const maintain = '/jic-backend-duty/duty'
const asyncVip = params => postAction(maintain + '/syncMemberInfo', params)


// 运营管理
const operate = '/jic-backend-platform'
export const storeList = params => postAction(operate + '/store/page', params)
export const getStoreInfoByCode = code => postAction(operate + '/store/getOtherData?code=' + code)
export const addStore = params => postAction(operate + '/store/add' , params)
export const generateQrCode = params => postAction(operate + '/wechat/qrCode/generate?qrCodeId='+params.qrCodeId, params)
export const updateStore = params => postAction(operate + '/store/update', params)
export const deleteStore = params => postAction(operate + '/store/delete?code=' + params.code)
export const getLocations = params => postAction(operate + '/open/open-center/open-api/map/baidu/location') 



//客服
const customService = '/jic-backend-aftersale/aftersale/kefu/'
const customServiceLocal = 'http://172.18.101.127:8012/aftersale/kefu/'
export const getQuestion = params => getAction(customService+'question/list',params)
export const getDetails = params => getAction(customService + 'question/'+params.id)
export const getCategories = params => getAction(customService+'category/list',params)
export const addkf = params => postAction(customService + 'createOrUpdate',params)
export const getiku = params => getAction(customService + 'tiku/list',params)
export const getConfig = params => getAction(customService + 'config/list',params)
export const move = params => getAction(`${customService}move/${params.id}/?move=${params.move}&type=${params.type}`)
export const deleteCustomService = params => deleteAction(`${customService}delete/${params.id}/?type=${params.type}`)
export const isHot = params => putAction(`${customService}question/hot/${params.id}?state=${params.state}`)
export const checkBrands = () => getAction(`${customService}config/brand`)

// 工具
export const inventoryExport = 'https://bzhz.jnbygroup.com/api/gateway/jic-backend-operation/operate/inventory/export'
export const lx = params => postAction(`/jic-backend-operation/common/excel/poll?key=${params.key}`)
export const deleteExport = params => postAction(`/jic-backend-operation/common/ossFile/del?key=${params.key}`)
export const inventoryCheckList = params => getAction(`/jic-backend-operation/operate/inventory/sku/list?brandId=${params.brandId}&sku=${params.sku}`)
export const inventoryDetail = params => getAction(`/jic-backend-operation/operate/mall/goods/detail?brandId=${params.brandId}&goodsId=${params.goodsId}`)
export const inventoryUpdateStock = (params, brandId) => postAction(`/jic-backend-operation/operate/mall/goods/updateStock?brandId=${brandId}`, params, brandId)
export const updateShelfStatus = (params,brandId,goodsId) => postAction(`/jic-backend-operation/operate/mall/goods/updateShelfStatus?brandId=${brandId}&goodsId=${goodsId}`,params, brandId,goodsId)

// 陪逛
const strolling = `/jic-backend-mall/mall/accompany`
export const saveSetting = params => postAction(`${strolling}/addOrUpdate`,params)
export const queryDetail = brandId => postAction(`${strolling}?brandId=${brandId}`)
export {
  messageList,
  templateList,
  downLoadLog,
  templateDetail,
  messageDetail,
  createMessage,
  createTemplate,
  templateDelete,
  messageDelete,
  sendMessage,
  exportXsl,
  asyncVip,
}
